package com.whuan.order.controller;

import com.whuan.order.clients.MessageClient;
import com.whuan.order.dataobject.ProductInfo;
import com.whuan.user.client.ProductClient;
import com.whuan.user.common.ProductInfoOutput;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@Slf4j
public class ClientController {

    /**
     *
     */
    @Autowired
    private ProductClient productClient;
    @Autowired
    private MessageClient messageClient;

/*    @GetMapping("/msg1")
    public String getMSG()
    {
        log.info("11111111111111111");
        String getmsg = productClient.getmsg();
        log.info("2222222222222222");
        return "client:"+getmsg;
    }*/

    @GetMapping("/msg2")
    public String getMSG2()
    {
        log.info("11111111111111111");
        String getmsg = messageClient.msg();
        log.info("2222222222222222");
        return "client:"+getmsg;
    }

    @GetMapping("/getProductListByProductId")
    public String getProductListByProductId(){
        List<ProductInfoOutput> productInfos = productClient.listForOrder(Arrays.asList("123", "cyys3668"));
        log.info("productInfos={}",productInfos);
        return "ok";
    }
}
